Install Required libraries:
sudo apt-get update && sudo apt-get install imagemagick gs
create directory to test commands
mkdir -p pdf_conversion/{merged,split}
cd pdf_conversion
download sample multi-page pdf to test with
curl -o LargeSample.pdf "http://cl.ly/0o1T453E153m/download/LargeSample.pdf"
Split a pdf into separate images
convert LargeSample.pdf split/page-%0d.jpg
Merge separate images into one full pdf.
convert split/*.jpg merged/full.pdf
Remove a page from a full pdf.
convert LargeSample.pdf split/page-%0d.jpg
rm split/page-2.jpg
convert split/*.jpg merged/full.pdf
With PHP: You can use PHP exec function to run these commands, ie:
|